package cn.larry.demo.service;

import javax.annotation.PostConstruct;

import org.springframework.beans.BeanWrapper;
import org.springframework.beans.BeanWrapperImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import cn.larry.demo.domain.Person;


/**
 * @author LarryZeal
 *
 */
@Service
public class BeanWrapperDemo {

	@Autowired
	private BeanWrapper beanWrapper; // 默认居然没有BeanWrapper，自己在@Configuration中注册好了。

	@PostConstruct
	public void run() {
		Person person = beanWrapper.convertIfNecessary("我是名字", Person.class);
		System.out.println("from cn.larry.demo.service.BeanWrapperDemo : " + person);
	}
}
